<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored ="false"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>北京市电子行政监察平台-发起任务</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link href="<%=path%>/css/base.css" rel="stylesheet" type="text/css" />
		<link href="<%=path%>/css/style.css" rel="stylesheet" type="text/css" />
		<link href="<%=path%>/css/frame.css" rel="stylesheet" type="text/css" />
		<link href="<%=path%>/css/jquery.treeview.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript">
			var path = "<%=path%>";
		</script>
		<script type="text/javascript" src="<%=path%>/javascript/core/jquery-1.6.1.min.js"></script>
		<script type="text/javascript" src="<%=path%>/javascript/core/jquery-jtemplates.pack.js"></script>
		<script type="text/javascript" src="<%=path%>/javascript/core/jquery.treeview.pack.js"></script>
		<script type="text/javascript" src="<%=path%>/javascript/core/jquery.metadata.js"></script>
		<script type="text/javascript" src="<%=path%>/javascript/core/jquery.validate.fixed.pack.js"></script>
		<script type="text/javascript" src="<%=path%>/javascript/config/config.js"></script>
		<script type="text/javascript" src="<%=path%>/javascript/system/util.js"></script>
		<script type="text/javascript" src="<%=path%>/javascript/system/oacore.js"></script>
		<script type="text/javascript" src="<%=path%>/javascript/system/accountBook.js"></script>
		<script type="text/javascript" src="<%=path%>/javascript/system/init.js"></script>
		<script language="javascript" type="text/javascript" src="<%=path%>/javascript/My97DatePicker/WdatePicker.js"></script>
		<script type="text/javascript">
			var accountBookJsonStr = "<%=((String)request.getAttribute("undertakerListString"))%>";
			$(function () {
				//初始化联系人
				var accountBook = new oacore.Widget.AccountBook({
					single: true,
					data: $.parseJSON(accountBookJsonStr),
					dataForm: $("#creatorForm"),
					autoHide: true,
					onHide: function () {
						if($.browser.msie)
							$("._hide").show();
					},
					onShow: function () {
						if($.browser.msie)
							$("._hide").hide();
					},
					host: $("input[type='text'].use-account-book:first"),
					//转化id和name
					pretreatment: function (data) {
						//id name
						data.id = data.userInfoId;
						delete data.userInfoId;
						data.name = data.userName;
						delete data.userName;
						return data;
					}
				});
				//初始化表单值校验器
				$("#creatorForm").validate();
				//初始化时间选择器
				$(".use-datepicker").click(function () {
						WdatePicker({
								dateFmt: "yyyy-MM-dd",
								minDate: "%y-%M-{%d}"
							});
					});
				//给select加上对应version
				$("select.need-version").bind("change", function () {
						var $this = $(this);
						var versionName = $this.attr("hiddenVersionName");
						var version = $(this.options[this.selectedIndex]).attr("version");
						var versionHidden = $("input[name='"+ versionName +"']");
						if(versionHidden.size() <= 0)
							$("<input type='hidden' value='"+ version +"' name='" + versionName + "'/>").appendTo($this.parents("form:first"));
						else
						{
							versionHidden.val(version);
						}
					}).trigger("change");

				
			});
		</script>
		<style type="text/css">
			div {
				position: static;
			}
		</style>
	</head>
	<body>
		<div id="mainPage" class="surround-layout">
			<jsp:include page="../frame/top.jsp" flush="true"></jsp:include>
			<div class="middle">
				<jsp:include page="../frame/middle_left.jsp" flush="true">
					<jsp:param value="1001-1003" name="view"/>
				</jsp:include>
				<!-- 右侧输出内容 -->
				<div class="right">
					<div class="right-all-content">
						<div>
							<div class="content-line-wrap">
								<div class="content-line-left content-line">
									<h1 class="content-title">
										<span>
											<a href="<%=path %>/web/toCreateMissionPageAction.action">任务发起</a>
										</span>
										<span>
										</span>
									</h1>
								</div>
							</div>
							<div class="inner-dialog">
								<h1 class="inner-dialog-title">发起任务</h1>
								<div class="inner-dialog-content">
								<!-- 填入action地址 -->
								<form method="post" action="<%=path%>/web/saveMissionAction.action" name="creatorForm" id="creatorForm" class="normal-form">
									<table>
										<tr>
											<td colspan="2" valign="top">
												<span class="form-field"><span class="important-field-star">*</span>任务名称:</span>
												<input id="taskName" type="text" name="missionDTO.missionName" 
												class="shadow nf-double-cell {required: true, dataName: true, maxlength: 32, messages: {required: '任务名称项为必填', maxlength: '任务名称项的长度不能超过32个字符', dataName: '任务名称的格式须为中英文、数字及下划线'}}"/>
											</td>
										</tr>
										<tr>
											<td valign="top">
												<span  class="form-field"><span class="important-field-star">*</span>任务计划结束日期:</span>
												<input type="text" name="missionDTO.scheduleEndDate" class="shadow nf-single-cell use-datepicker {required: true, messages: {required: '任务计划结束日期项为必选'}}"/>
											</td>
											<td valign="top">
												<span class="form-field"><span class="important-field-star">*</span>重要程度:</span>
												<select name="missionDTO.importanceDTO.dataValueId" id="importanceLevelSelector" hiddenVersionName="missionDTO.importanceDTO.version" class="need-version required {required: true, messages: {required: '重要程度项为必选'}}">
													<s:if test="importanceList">
														<s:iterator id="importance" value="importanceList">
															<option value="${importance.dataValueId}" version="${importance.version }">${importance.value}</option>
														</s:iterator>
													</s:if>
												</select>
											</td>
										</tr>
										<tr>
											<td valign="top">
												<span class="form-field"><span class="important-field-star">*</span>承办人:</span>
												<input type="text" id="accountBook" name="missionDTO.undertakerDTO.userInfoId" class="shadow use-account-book nf-single-cell {required: true, messages: {required: '承办人项为必选'}}" readonly="readonly" class="shadow nf-single-cell use-account-book"></input>
											</td>
											<td valign="top">
												<span class="form-field"><span class="important-field-star">*</span>任务类型:</span>
												<select name="missionDTO.missionTypeDTO.dataValueId" hiddenVersionName="missionDTO.missionTypeDTO.version" class="need-version {required: true, messages: {required: '任务类型项为必选'}}">
														<option value="">-请选择任务类型-</option>
														<s:if test="missionTypeList!=null">
															<s:iterator value="missionTypeList" id="missionTypeDTO">
																<option value="${missionTypeDTO.dataValueId }" version="${missionTypeDTO.version }"><s:property value="#missionTypeDTO.value"/></option>
															</s:iterator>
														</s:if>
												</select>
											</td>
										</tr>
										<tr>
											<td colspan="2" valign="top">
												<span class="form-field">任务描述:</span>
												<textarea name="missionDTO.description" class="shadow nf-double-cell {maxlength: 64, messages: {maxlength: '任务描述项的长度不能超过64个字符'}}" ></textarea>
											</td>
										</tr>
										<tr>
											<td valign="top">
												<input type="submit" value="发起" class="special originate"></input>
											</td>
										</tr> 
									</table>
								</form>
								</div>
							</div>
						</div>
					</div>
				</div>
				<!--  -->
			</div>
		</div>
	</body>
</html>